package model;

import java.util.List;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

@XmlRootElement
@XmlType(propOrder = { "carddecks" })
public class CardDecks {

	List<CardDeck> carddecks = null;

	@XmlElementWrapper(name = "CardDeck")
	@XmlElement(name = "deck")
	public List<CardDeck> getCarddecks() {
		return carddecks;
	}

	public void setCarddecks(List<CardDeck> carddecks) {
		this.carddecks = carddecks;
	}
	
	public boolean setsingleCardtoDeck(Card card, String name){
		
		if( carddecks == null || name == null || carddecks.isEmpty()){
			return false;
		}else{		
			//iteriere ueber die carddecks, finde den mit dem namen
			//und fuege diesem die card hinzu
		return true;
		}
	}
	
	public CardDeck getCarddeck(String name){
		for(CardDeck cd : carddecks){
			if(cd.name.equals(name))
				return cd;
		}
		return null;
	}
	
}
